﻿@using RH.Common.Extensions;
@using RH.Web.Utility;
@{
    List<RH.Web.ViewModels.CategoryViewModel> _ParentCategories = (from P in ApplicationCache.Categories orderby P.Name where P.ParentID == null select P).ToList();    
}
<div>
    <div class="grid_5">
        <a href="/"><img class="logo" src="/Content/Images/logo.png" alt="BdMarket Logo" title="BdMarket Logo"/></a>
    </div>
    <div class="grid_11">
        <div class="header-link-container white-link text-shadow" style="color:#ffffff;">          
            @Html.PublicLink("Home", "Index", "Home") | 
            @Html.Partial("_LogOnPartial") | 
            @*<a href="/contact-us" title="Contact Us">Contact Us</a>*@
            @if (UserInfo.IsCompanyUser || UserInfo.IsAdmin || UserInfo.IsSiteUser)
            {
                @Html.PrivateLink("Dashboard", "DashBoard", "Account") <text>|</text> 
            }            
            else
            {
                @Html.PublicLink("Register", "Register", "Account") <text>|</text>
            }  
            <span class="span-compare" style="cursor:pointer;" onclick="GoComparePage();">Compare(@SessionCache.ProductCompareList.Count)</span> | 
            <a class="cregistration" href="/Company/Registration">List Your Product</a>            
            <div class="clear"></div>
        </div>               
    </div>
    <div class="clear"></div>    
</div>

@*<div class="main_nav_background"></div>*@
<div class="main_nav transparent-back">
    <ul>
        @foreach (RH.Web.ViewModels.CategoryViewModel parentCategory in _ParentCategories)
        {
            <li categoryid="@parentCategory.ID"><a href="@HtmlHelpers.GetCategoryListLink(parentCategory.Name)" title="@parentCategory.Name">@parentCategory.Name</a></li>
        }        
    </ul>    
    <div class="clear"></div>
</div>

@*Category Dropdown Menus for Top Navigation*@
@foreach (RH.Web.ViewModels.CategoryViewModel parentCategory in _ParentCategories)
{
    <div id="divCatTree_@(parentCategory.ID)" class="category-tree-container semi-transparent">        
        @*@Html.RenderCategoryMenu(parentCategory.ID, false)*@
        @Html.GenerateCategoryMenu(parentCategory.ID)
        <div class="clear"></div>
    </div>
}
<div id="divMenuGetis" class="menu-getis"></div>
@*<div style="margin-top:10px;"></div>*@
@Html.Partial("_ProductCompareLightBox")
<script language="javascript" type="text/javascript">
    $(document).ready(function () {
        $('.main_nav li').each(function () {
            $(this).mouseover(function () {
                $('.category-tree-container').hide();
                $('.main_nav li').removeClass('selected-menu');
                var divID = 'divCatTree_' + $(this).attr('categoryid');
                var div = $('#' + divID);
                var position = $(this).position();
                $('#divMenuGetis').css('top', position.top + 43).css('left', position.left).width($(this).width()).show();
                $(div).show();
                $(this).addClass('selected-menu');
            });
        });
        $(document).mouseover(function () {
            $('.category-tree-container').hide();
            $('.main_nav li').removeClass('selected-menu');
            $('#divMenuGetis').hide();
        });
        $('.category-tree-container').mouseover(function (e) {
            e.stopPropagation();
        });
        $('.main_nav li').mouseover(function (e) {
            e.stopPropagation();
        });
        $('.menu-getis').mouseover(function (e) {
            e.stopPropagation();
        });
        
    });
    function SearchProduct() {
        if ($('#txtSearch').val() != 'I\'m looking for...')
            window.location.href = "/Product/Search?Key=" + $('#txtSearch').val();
        else
            ShowMessage();
    }
</script>